package com.xsky.common.logic;

import java.util.Calendar;

import org.apache.commons.lang.RandomStringUtils;

public class BillNoGenerator {

	public static String getBillNo() {
		
		Calendar cal = Calendar.getInstance();
		int year = cal.get(Calendar.YEAR);
		int month = cal.get(Calendar.MONTH) + 1;
		int day = cal.get(Calendar.DAY_OF_MONTH);
		int h = cal.get(Calendar.HOUR_OF_DAY);
		int m = cal.get(Calendar.MINUTE);
		int s = cal.get(Calendar.SECOND);

		StringBuilder sb = new StringBuilder();
		sb.append(year);
		sb.append(month > 9 ? month : "0" + month);
		sb.append(day > 9 ? day : "0" + day);
		sb.append(h > 9 ? h : "0" + h);
		sb.append(m > 9 ? m : "0" + m);
		sb.append(s > 9 ? s : "0" + s);
		sb.append(RandomStringUtils.randomNumeric(8));

		return sb.toString();

	}
}
